<?php

namespace common\validate;


class ProjectTemplate extends BaseValidate
{
    // 验证规则
    protected $rule = [];

    // Fields 验证场景定义
    public function sceneFields()
    {
        return $this;
    }

    // Find 验证场景定义
    public function sceneFind()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array');
    }

    // Select 验证场景定义
    public function sceneSelect()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array')
            ->append('param.page', 'array');
    }

    // Create 验证场景定义
    public function sceneCreate()
    {
        return $this;
    }

//    // Create 验证场景定义
//    public function sceneCreate()
//    {
//        return $this
//            ->append('data.directory_template_id', 'require');
//    }

    // Update 验证场景定义
    public function sceneUpdate()
    {
        return $this->append('data.id', 'require')
            ->append('data.name', 'max:128')
            ->append('data.code', 'max:128')
            ->append('data.config', 'array');
    }

    // Delete 验证场景定义
    public function sceneDelete()
    {
        return $this->append('param.filter', 'require');
    }

    // GetGroupListByModule 验证场景定义
    public function sceneGetGroupListByModule()
    {
        return $this->append('param', 'require')
            ->append('param.filter', 'array')
            ->append('param.page', 'array');
    }

    // FindPlanTemplate 验证场景定义
    public function sceneFindPlanTemplate()
    {
        return $this->append("param.filter.id", "require|integer");
    }

    // UpdatePlanTemplate 验证场景定义
    public function sceneUpdatePlanTemplate()
    {
        return $this->append('data.id', 'require')
            ->append('data.step_category_plan', 'require|array')
            ->append('data.step_category_plan.project', 'require|array')
            ->append('data.step_category_plan.updated', 'array')
            ->append('data.step_category_plan.deleted', 'array');
    }


    // StatisticalStepTemplate 验证场景定义
    public function sceneUpdateStatisticalStepTemplate()
    {
        return $this->append('data.producer_step_category_config', 'require|array');
    }

    // FindStatisticalStepTemplate 验证场景定义
    public function sceneFindStatisticalStepTemplate()
    {
        return $this->append("param.filter.id", "integer");
    }

    // FindModuleFieldConfig 验证场景定义
    public function sceneFindModuleFieldConfig()
    {
        return $this->append("param.filter.id", "require|integer");
    }

    // UpdateModuleFieldConfig 验证场景定义
    public function sceneUpdateModuleFieldConfig()
    {
        return $this->append('data.id', 'require|integer')
            ->append('data.module_field_config', 'require|array');
    }

    // FindStepCategoryConfig 验证场景定义
    public function sceneFindStepCategoryConfig()
    {
        return $this->append("param.filter.id", "require|integer");
    }

    // UpdateStepCategoryConfig 验证场景定义
    public function sceneUpdateStepCategoryConfig()
    {
        return $this
            ->append('data.id', 'require|integer')
            ->append('data.producer_step_category_config', 'require|array');
    }
}
